!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define("rb_wixui.thunderbolt[TextInput]",["react"],t):"object"==typeof exports?exports["rb_wixui.thunderbolt[TextInput]"]=t(require("react")):e["rb_wixui.thunderbolt[TextInput]"]=t(e.React)}("undefined"!=typeof self?self:this,(function(e){return function(){var t={5329:function(t){"use strict";t.exports=e},448:function(e){function t(){return e.exports=t=Object.assign?Object.assign.bind():function(e){for(var t=1;t{const n=[];return e&&n.push(`${l}${e}`),t.forEach((e=>{e&&(n.push(`${l}${e}`),n.push(e))})),n.join(" ")},s=13,d=27;function c(e){return t=>{t.keyCode===e&&(t.preventDefault(),t.stopPropagation(),t.currentTarget.click())}}c(32),c(s),c(d);const p=["aria-id","aria-metadata","aria-type"],f=({role:e,tabIndex:t,tabindex:n,...r}={})=>{const o=Object.entries(r).reduce(((e,[t,n])=>({...e,[`aria-${t}`.toLowerCase()]:n})),{role:e,tabIndex:t??n});return Object.keys(o).forEach((e=>{void 0!==o[e]&&null!==o[e]||delete o[e]})),a=o,i=p,Object.entries(a).reduce(((e,[t,n])=>(i.includes(t)||(e[t]=n),e)),{});var a,i};const m=({size:e,...t})=>n.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",width:e||"20",height:e||"20",...t},n.createElement("path",{fillRule:"evenodd",d:"M9.5,3 C13.084,3 16,5.916 16,9.5 C16,13.084 13.084,16 9.5,16 C5.916,16 3,13.084 3,9.5 C3,5.916 5.916,3 9.5,3 Z M9.5,4 C6.467,4 4,6.467 4,9.5 C4,12.533 6.467,15 9.5,15 C12.533,15 15,12.533 15,9.5 C15,6.467 12.533,4 9.5,4 Z M10,11 L10,12 L9,12 L9,11 L10,11 Z M10,7 L10,10 L9,10 L9,7 L10,7 Z"}));m.displayName="ErrorSmall";var h=m,v="TLWrjM",y="GIPQqH",g="JNgJbf";const b=e=>{let{errorMessage:t,errorMessageType:r,shouldShowValidityIndication:o,translations:a,dataHook:i,componentViewMode:l}=e;const u="editor"===l?(null==a?void 0:a.errorMessage)||"Error text displays here.":t;return"inline"===r&&o&&u?n.createElement("div",{"data-hook":i||"inline-error-message",className:v},n.createElement(h,{className:y}),n.createElement("span",{className:g},u)):null};var x={root:"text-input",inputEl:"text-input__input",inputLabel:"text-input__label"},C={input:"KvoMHf",hideNumberSpinner:"ErucfC",AppsTextInputSkin:"MpKiNN",appsTextInputSkin:"MpKiNN",inputWrapper:"pUnTVX",prefix:"eXvLsN","validation-indication":"LyB02C",validationIndication:"LyB02C",label:"wPeA6j",hasLabel:"qzvPmW","required-indication":"lPl_oN",requiredIndication:"lPl_oN",ResponsiveTextInputSkin:"ZXdXNL",responsiveTextInputSkin:"ZXdXNL"};const E="Please enter a phone number with {digits} digits",I="Please enter between 4 to 17 digits. You can include hyphens (-) or start with a (+), e.g., 555-123-4567 or +(222)987654321",M="Please enter between 4 to 17 digits. You can include dividers (-), e.g., 555-123-4567.",_=function(e,t,n){void 0===n&&(n=!0);return Array.from(t).reduce(((e,t,n)=>"-"===t?[...e,n]:e),[]).filter(((t,r)=>n?t<=e.length:t<=e.length+r))},L=(e,t)=>t.replace("{digits}",""+(e?e.replace(/-/g,"").length:0)),O=()=>{},N=(e,r)=>{var o;const{skin:a,name:l,id:s,className:d="",customClassNames:c=[],dataTestId:p,value:m,inputType:h="text",label:v,placeholder:y,readOnly:g,required:N,isDisabled:V,pattern:T,autoComplete:w,autoComplete_:P,maxLength:A,min:j,max:S,step:F,numberSpinnerHidden:R,shouldShowValidityIndication:k,isValid:H,autoFocus:D,prefix:q,phoneFormat:X="",errorMessageType:Z="tooltip",validateValue:$=O,setValidityIndication:B=O,onBlur:K=O,onFocus:U=O,onKeyPress:W=O,onInput:z=O,onValueChange:G=O,onChange:J=O,onClick:Y=O,onDblClick:Q=O,onMouseEnter:ee=O,onMouseLeave:te=O,onHydrationComplete:ne=O,ariaAttributes:re,contentRef:oe,translations:ae,componentViewMode:ie,textInputAutoFillFixEnabled:le}=e,ue=n.useRef(null),[se,de]=n.useState(!0);n.useImperativeHandle(r,(()=>({focus:()=>{var e;null==(e=ue.current)||e.focus()},blur:()=>{var e;null==(e=ue.current)||e.blur()},setCustomValidity:t=>{var n,r;"message"===t.type?null==(n=ue.current)||n.setCustomValidity(t.message):null==(r=ue.current)||r.setCustomValidity(((e,t)=>{let{translations:n,phoneFormat:r}=t;switch(e.key){case"PHONE_FORMAT_LENGTH_VALIDATION_ERROR":return L(r,(null==n?void 0:n.phoneFormatLengthValidationError)||E);case"PHONE_FORMAT_DEFAULT_VALIDATION_ERROR":return(null==n?void 0:n.phoneFormatDefaultValidationError)||I;case"PHONE_FORMAT_COMPLEX_PHONE_DEFAULT_VALIDATION_ERROR":return(null==n?void 0:n.phoneFormatComplexPhoneDefaultValidationError)||M;default:return e.key}})(t,{translations:e.translations,phoneFormat:e.phoneFormat}))},getValidationMessage:()=>{var e;return null==(e=ue.current)?void 0:e.validationMessage}})));const ce=n.useRef(),pe=n.useMemo((()=>"tel"===h&&X?((e,t)=>{const n=_(e,t,!1),r=Array.from(e);return n.forEach((e=>{e{let{shouldHideValidityIndication:t,shouldCallOnInput:n}=e;return e=>{const{value:r}=e.target;let o=r;if(X){const e=r.length{const r=_(e,t);return r.reduce(((t,o,a)=>{if(" "===e[o])t.splice(o-a,1);else if(" "!==e[o+1]||n)" "===e[o-1]&&n&&(e.split(" ").length-1{le&&!ye()&&J({...e,type:"change"})})(e),$()),t&&B(!1),n&&z(e)}};n.useEffect((()=>{var e,t;fe({shouldHideValidityIndication:!0,shouldCallOnInput:!1})({target:{value:null!=(e=null==(t=ue.current)?void 0:t.value)?e:""}}),ne({type:"onHydrationComplete"})}),[]);const me=i(C[a],d,u(x.root,...c),{[C.hasLabel]:!!v,[C.requiredIndication]:N,[C.validationIndication]:!!k}),{"aria-label":he,...ve}=f(re),ye=()=>!!ue.current&&ue.current===document.activeElement;return n.createElement("div",t()({id:s},(e=>Object.entries(e).reduce(((e,[t,n])=>(t.includes("data-")&&(e[t]=n),e)),{}))(e),{ref:oe,className:me,"data-testid":p,onClick:e=>{V||Y(e)},onDoubleClick:e=>{V||Q(e)},onMouseEnter:e=>{V||ee(e)},onMouseLeave:e=>{V||te(e)}}),!!v&&n.createElement("label",{htmlFor:"input_"+s,className:i(C.label,u(x.inputLabel))},v),n.createElement("div",{className:C.inputWrapper},q&&n.createElement("div",{className:C.prefix},q),n.createElement("input",t()({name:l,ref:ue,id:"input_"+s,className:i(C.input,"has-custom-focus",u(x.inputEl),{[C.hideNumberSpinner]:R}),type:h,value:pe,onFocus:U,onKeyDown:W,onChange:fe({shouldHideValidityIndication:!0,shouldCallOnInput:!0}),onBlur:e=>{K(e),ce.current&&J({...e,type:"change"}),ce.current=!1,B(!0),se&&de(!1)},placeholder:y,readOnly:g,required:N,"aria-required":N,"aria-invalid":(()=>{var e;if(!1===H)return!0;const t=!(null!=(e=ue.current)&&e.validity.valid);return!se&&t})(),pattern:T,maxLength:(()=>{let e=null===A?void 0:A;return X&&(e=X.length),e})(),minLength:X?X.length:void 0,disabled:V,autoComplete:w?"on":P||"off",step:null===F?void 0:F,min:null===j?void 0:j,max:null===S?void 0:S,autoFocus:D,"aria-label":he||v?he:y},ve))),n.createElement(b,{errorMessageType:Z,errorMessage:null==(o=ue.current)?void 0:o.validationMessage,shouldShowValidityIndication:k,translations:ae,componentViewMode:ie}))};const V=e=>e.replace(/([A-Z])/g,(e=>`-${e.toLowerCase()}`));var T;const w={TextInput:{component:n.forwardRef(N),controller:(T=e=>{let{mapperProps:t,controllerUtils:n}=e;return{...t,...(r=n.updateProps,{onValueChange:e=>{r({value:e})},setValidityIndication:e=>{r({shouldShowValidityIndication:e})}})};var r},{useComponentProps:(e,t,n)=>{const r=(e=>({...e,updateStyles:t=>{const n=Object.entries(t).reduce(((e,[t,n])=>{return{...e,[(r=t,r.startsWith("--")?t:V(t))]:void 0===n?null:n};var r}),{});e.updateStyles(n)}}))(n);return T({mapperProps:e,stateValues:t,controllerUtils:r})}})}}}(),o}()})); //# sourceMappingURL=https://static.parastorage.com/services/editor-elements-library/dist/thunderbolt/rb_wixui.thunderbolt[TextInput].2b53e702.bundle.min.js.map